home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-07-23 | 1.1 KB | 69 lines | [TEXT/MPS ] |
- //
- // © Copyright 1990 Apple Computer, Inc. By Ricardo Batista
- //
-
- #include "Types.h"
- #include "Memory.h"
- #include "Menus.h"
- #include "Packages.h"
- #include "HyperXCMD.h"
-
-
- void GetHLong(Handle H, long *s);
- void GetHString(Handle H, char *s);
-
- pascal void MAIN(XCmdPtr xcmd)
- {
- char data[255];
- long item;
- long num;
-
- if (xcmd->paramCount != 3)
- return;
- GetHLong(xcmd->params[0], &num);
- if (!num)
- return;
- GetHLong(xcmd->params[1], &item);
- GetHString(xcmd->params[2], data);
- SetItem((MenuHandle) num, (short) item, data);
- }
-
-
- void GetHLong(Handle H, long *s)
- {
- short len;
- char st[256];
-
- *s = 0L;
- HLock(H);
- len = (short) GetHandleSize(H);
- if (len > 255)
- len = 255;
- BlockMove(*H, &st[1], (long) len);
- HUnlock(H);
- len = 1;
- while (st[len])
- len++;
- st[0] = len - 1;
- StringToNum(st, s);
- }
-
-
-
- void GetHString(Handle H, char *s)
- {
- short len;
- char st[256];
-
- HLock(H);
- len = (short) GetHandleSize(H);
- if (len > 255)
- len = 255;
- BlockMove(*H, &st[1], (long) len);
- HUnlock(H);
- len = 1;
- while (st[len])
- len++;
- st[0] = len - 1;
- BlockMove(st, s, (long) len);
- }